package zero.tech.core.work;

public class DelayWorkTest {
	public static void main(String[] args) {
//		WorkManager.getManager().submit(new DWork("like", 5000));
		WorkManager.getManager().submit(new DWork("how", 3000));
		WorkManager.getManager().submit(new DWork("hello", 1000));
	}
	
	public static class DWork extends DelayQueueWork{
		
		public DWork(Object ext, long delaytime) {
			super(ext, delaytime);
		}

		@Override
		public DelayWorkQueue getDelayQueue() {
			return new DelayWorkQueue() {
				@Override
				public long getId() {
					return 0;
				}
			};
		}

		@Override
		public void delayrun() {
			System.out.println(ext);
			WorkManager.getManager().submit(new DWork(ext, delaytime));
			try {
				Thread.sleep(10000);//模拟业务耗时
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		
	}
}
